// 面试技巧所有请求

import request from '@/utils/request'

// 获取所有文章列表
export function getArticles(params) {
  return request({
    url: '/articles',
    method: 'get',
    params
  })
}
// 文章详情
export function getArticle(id) {
  return request({
    url: '/articles/' + id,
    method: 'get'
  })
}
// 添加文章
export function addArticle(data) {
  return request({
    url: '/articles',
    method: 'post',
    data
  })
}
// 修改文章状态
export function editArticleState(data) {
  return request({
    url: `/articles/${data.id}/${data.state}`,
    method: 'post'
  })
}
// 文章编辑
export function editArticle(data) {
  return request({
    url: '/articles/' + data.id,
    method: 'put',
    data
  })
}
// 文章删除
export function delArticle(id) {
  return request({
    url: '/articles/' + id,
    method: 'delete'
  })
}
